﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DeVetma.admin.models;
using DeVetma.admin.classes;
using DeVetma.admin.models.database;
using DeVetma.admin.models.database.metadata;
using DeVetma.admin.models.managers;

namespace DeVetma.admin.models.entities
{
    [Entity(table="Staff")]
    public class Staff
    {
        [EntityField(column="sUsername",keyField=true,nullValue=null)]
        public string sUsername { get; set; }

        [EntityField(column="sFName",keyField=false,nullValue=null)]
        public string sFName { get; set; }

        [EntityField(column = "sLName", keyField = false, nullValue = null)]
        public string sLName { get; set; }

        [EntityField(column = "sGender", keyField = false, nullValue = null)]
        public string sGender { get; set; }

        [EntityField(column = "sEmail", keyField = false, nullValue = null)]
        public string sEmail { get; set; }

        [EntityField(column = "sTel", keyField = false, nullValue = null)]
        public string sTel { get; set; }

        [EntityField(column = "sStatus", keyField = false, nullValue = null)]
        public string sStatus { get; set; }

        public User user
        {
            get { return getUser(); }
            set { this.sUsername = value.uUsername; }
        }

        private static string[] statuses = new string[] { "inActive","active" };
        public enum StaffStatus { InActive, Active }

        public string status(StaffStatus stat)
        {
            return statuses[(int)stat];
        }

        private User getUser()
        {
            return new UserManager().get(sUsername);
        }
    }
}